package com.dongjiantong.biz.serviceImpl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongjiantong.biz.mapper.DjtButcherReportsFormsMapper;
import com.dongjiantong.biz.model.DjtButcherReportsForms;
import com.dongjiantong.biz.service.DjtButcherReportsFormsService;
import com.dongjiantong.mybatis.ServiceMybatis;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.Date;

/**
 * Created by ThinkPad on 2017/11/20.
 */
@Slf4j
@Service(version = "1.0.0")
public class DjtButcherReportsFormsServiceImpl extends ServiceMybatis<DjtButcherReportsForms> implements DjtButcherReportsFormsService {

    @Resource
    private DjtButcherReportsFormsMapper djtButcherReportsFormsMapper;


    /**
     *  根据官方兽医查询 和时间段查询 屠宰检疫报表
     *
     * @param startTime
     * @param endTime
     * @param pageNum
     * @param pageSize
     * @param vetUserId
     * @return
     */
    @Override
    public PageInfo<DjtButcherReportsForms> selectByVetUserIdAndReportTime(Date startTime, Date endTime, int pageNum, int pageSize, Long vetUserId) {
        Example example = new Example(DjtButcherReportsForms.class);
        example.createCriteria().andBetween("report_date", startTime, endTime).andEqualTo("vet_user_id", vetUserId);
        PageHelper.startPage(pageNum, pageSize);
        return new PageInfo<DjtButcherReportsForms>(djtButcherReportsFormsMapper.selectByExample(example)) ;
    }
}
